<?php
/*
 * Created on 24 janv. 2009
 * Created by Ludovic Reenaers
 * lreenaers@hotmail.com
 */

 class DAOFactory{
 	protected $pdo;
 	protected $Langue;
 	protected $LangueDAO=null;
 	protected $NomCategorieDAO=null;
 	protected $TooltipDAO=null;
 	protected $CategorieDAO=null;
 	protected $TokenDAO=null;
 	protected $ProfileDAO=null;
 	protected $UserDAO=null;
 	function __construct(){
 		$this->pdo=new PDO("mysql:host=localhost;dbname=bavet;charset=UTF-8","root","makemyday");
		$this->pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
		$this->Langue = $this->getLangueDAO()->getByAbr($_SESSION['langue']);
		
 	}
 	function getUserDAO(){
 		if($this->UserDAO==null){
 			$this->UserDAO = new UserDAO($this->pdo,$this);
 		}
 		return $this->UserDAO;
 	}
 	function getProfileDAO(){
 		if($this->ProfileDAO==null){
 			$this->ProfileDAO = new ProfileDAO($this->pdo,$this);
 		}
 		return $this->ProfileDAO;
 	}
 	function getTokenDAO(){
 		if($this->TokenDAO==null){
 			$this->TokenDAO = new TokenDAO($this->pdo,$this);
 		}
 		return $this->TokenDAO;
 	}
 	function getLangueDAO(){
 		if($this->LangueDAO==null){
 			$this->LangueDAO = new LangueDAO($this->pdo,$this);
 		}
 		return $this->LangueDAO; 
 	}
 	
 	function getCategorieDAO(){
 		if($this->CategorieDAO==null){
 			$this->CategorieDAO = new CategorieDAO($this->pdo,$this);
 		}
 		return $this->CategorieDAO;
 	}
 	function getDocumentDAO(){
 		if($this->DocumentDAO==null){
 			$this->DocumentDAO = new DocumentDAO($this->pdo,$this);
 		}
 		return $this->DocumentDAO;
 	}
 }
?>
